﻿<Dialogs:DialogWindow 
             x:Class="Mnk.TBox.Plugins.Requestor.Components.FormRequest"
             xmlns:loc="clr-namespace:Mnk.TBox.Plugins.Requestor.Code.Localization"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:Dialogs="clr-namespace:Mnk.Library.WpfControls.Dialogs;assembly=Mnk.Library.WPFControls"
    xmlns:sh="clr-namespace:Mnk.Library.WpfSyntaxHighlighter;assembly=Mnk.Library.WPFSyntaxHighlighter"
             xmlns:Units="clr-namespace:Mnk.Library.WpfControls.Components.Units;assembly=Mnk.Library.WPFControls"
             xmlns:Settings="clr-namespace:Mnk.TBox.Plugins.Requestor.Code.Settings"
             xmlns:Components="clr-namespace:Mnk.TBox.Plugins.Requestor.Components"
             xmlns:network="clr-namespace:Mnk.Library.Common.Network;assembly=Mnk.Library.Common"
    xmlns:controls="clr-namespace:Mnk.TBox.Core.PluginsShared.Controls;assembly=Mnk.TBox.Core.PluginsShared"
    xmlns:captioned2="clr-namespace:Mnk.Library.WpfControls.Components.Captioned;assembly=Mnk.Library.WPFControls"
    xmlns:components="clr-namespace:Mnk.Library.WpfControls.Components;assembly=Mnk.Library.WPFControls"
    mc:Ignorable="d" 
             Width="500" Height="600" MinWidth="500" MinHeight="500"
             Title="{Binding Key}"
            >
    <DockPanel>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" DockPanel.Dock="Bottom" Margin="5">
            <Button Name="btnTest" Content="{loc:Tr Test}" Click="BtnTestClick" IsDefault="True"/>
            <Button Content="{loc:Tr Cancel}" Click="CancelClick" IsCancel="True"/>
        </StackPanel>
        <TabControl Name="Tabs">
            <TabItem Header="{loc:Tr Request}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="48" MinHeight="48"/>
                        <RowDefinition Height="160" MinHeight="64"/>
                        <RowDefinition Height="5" />
                        <RowDefinition MinHeight="64"/>
                    </Grid.RowDefinitions>
                    <DockPanel>
                        <captioned2:CaptionedEnumDropDownList Caption="{loc:Tr Method}" SourceEnumType="network:HttpMethod" Value="{Binding Request.Method}" Margin="5" Width="108" DockPanel.Dock="Left" />
                        <captioned2:CaptionedComboBox Name="cbUrl" Value="{Binding Request.Url}" ItemsSource="{Binding KnownUrls, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Components:FormRequest}}}" IsEditable="True" Caption="{loc:Tr Url}" Margin="5" DockPanel.Dock="Top"/>
                    </DockPanel>
                    <DockPanel Grid.Row="1">
                        <Label Content="{loc:Tr Headers}" Margin="0" Padding="0" HorizontalAlignment="Center" DockPanel.Dock="Top"/>
                        <Units:ListBoxUnit Name="Headers" >
                            <Units:ListBoxUnit.ItemTemplate>
                                <DataTemplate DataType="{x:Type Settings:Header}">
                                    <StackPanel Margin="0,5">
                                        <TextBlock Text="{Binding Key}" Padding="0" FontWeight="Bold" />
                                        <components:AutoComboBox Text="{Binding Value}" Padding="0" IsEditable="True" 
                                              ItemsSource="{Binding KnownHeaderValues, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Components:FormRequest}}}"/>
                                    </StackPanel>
                                </DataTemplate>
                            </Units:ListBoxUnit.ItemTemplate>
                        </Units:ListBoxUnit>
                    </DockPanel>
                    <GridSplitter Grid.Row="2" ResizeDirection="Rows" HorizontalAlignment="Stretch"/>
                    <DockPanel Grid.Row="3">
                        <Label Content="{loc:Tr Body}" Margin="0" Padding="0" HorizontalAlignment="Center" DockPanel.Dock="Top"/>
                        <sh:SyntaxHighlighter Text="{Binding Request.Body}"/>
                    </DockPanel>
                </Grid>
            </TabItem>
            <TabItem Header="{loc:Tr Response}">
                <controls:ResponseBox Name="Response"/>
            </TabItem>
        </TabControl>
    </DockPanel>
</Dialogs:DialogWindow>
